<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>留守儿童信息管理系统</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/materialdesignicons.min.css" rel="stylesheet">
    <link href="/css/layer.css" rel="stylesheet">
    <link href="/css/style.min.css" rel="stylesheet">
</head>

<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside class="lyear-layout-sidebar">
            <!-- logo -->
            <div id="logo" class="sidebar-header">
                <a  th:href="@{/index}"><img src="/images/logo-sidebar.png" title="LightYear" alt="LightYear" /></a>
            </div>
            <div class="lyear-layout-sidebar-scroll">

                <nav class="sidebar-main">
                    <ul class="nav nav-drawer">
                        <li class="nav-item"> <a th:href="@{/index}" ><i class="mdi mdi-home"></i> 后台首页</a> </li>
                        <li class="nav-item nav-item-has-subnav" id="admin">
                            <a href="javascript:void(0)"><i class="mdi mdi-account"></i> 管理员管理</a>
                            <ul class="nav nav-subnav">
                                <li > <a th:href="@{/adminList}" >管理员列表</a> </li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav" id="children">
                            <a href="javascript:void(0)"><i class="mdi mdi-account"></i> 留守儿童管理</a>
                            <ul class="nav nav-subnav">
                                <li> <a th:href="@{/childrenList}">留守儿童列表</a> </li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav" id="veteran">
                            <a href="javascript:void(0)"><i class="mdi mdi-account"></i> 退伍军人管理</a>
                            <ul class="nav nav-subnav">
                                <li><a th:href="@{/veteranList}">退伍军人列表</a></li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav active open" id="elderly">
                            <a href="javascript:void(0)"><i class="mdi mdi-account"></i> 独居老人管理</a>
                            <ul class="nav nav-subnav">
                                <li class="active"> <a th:href="@{/elderlyList}">独居老人列表</a> </li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav" id="gift">
                            <a href="javascript:void(0)"><i class="mdi mdi-account"></i> 礼品管理</a>
                            <ul class="nav nav-subnav">
                                <li><a th:href="@{/giftList}">礼品列表</a></li>
                                <li><a th:href="@{/giftMoney}">礼品金额列表</a></li>

                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav" id="elderlyGift">
                            <a href="javascript:void(0)"><i class="mdi mdi-account"></i> 礼品管理</a>
                            <ul class="nav nav-subnav">
                                <li><a th:href="@{/elderlyGiftList}">礼品列表</a></li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav" id="community">
                            <a href="javascript:void(0)"><i class="mdi mdi-account"></i> 社区工作人员管理</a>
                            <ul class="nav nav-subnav">
                                <li> <a th:href="@{/communityList}">社区工作人员列表</a> </li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav" id="examine">
                            <a href="javascript:void(0)"><i class="mdi mdi-email"></i> 审核管理</a>
                            <ul class="nav nav-subnav">
                                <li id="examineStatus"><a th:href="@{/regExamine}">注册审核 <span class="badge" th:text="${session.examineStatusSize}" id="examineStatusSize"></span></a></li>
                                <li id="cancellation"><a th:href="@{/cancelExamine/{userName}/(userName=${session.username})}">账号注销审核 <span class="badge" id="cancellationSize" th:text="${session.cancellationSize}"></span></a></li>
                                <li id="delChildren"><a th:href="@{/delChildrenExamine}">删除儿童信息审核 <span class="badge" th:text="${session.DelChildrenSize}" id="DelChildrenSize"></span></a></li>
                                <li id="delVeteran"><a th:href="@{/delVeteranExamine}">删除退伍军人信息审核 <span class="badge" th:text="${session.DelVeteranSize}" id="DelVeteranSize"></span></a></li>
                                <li id="delElderly"><a th:href="@{/delElderlyExamine}">删除独居老人信息审核 <span class="badge" th:text="${session.DelElderlySize}" id="DelElderlySize"></span></a></li>
                                <li id="giftExamine"><a th:href="@{/giftExamine}">礼品信息审核 <span class="badge" th:text="${session.GiftSize}" id="GiftSize"></span></a></li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav" id="information">
                            <a href="javascript:void(0)"><i class="mdi mdi-message-draw"></i> 信息反馈</a>
                            <ul class="nav nav-subnav">
                                <li> <a th:href="@{/feedBack}">信息反馈</a> </li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav" id="system">
                            <a href="javascript:void(0)"><i class="mdi mdi-settings"></i> 系统维护</a>
                            <ul class="nav nav-subnav">
                                <li> <a th:href="@{/notice}">系统公告</a> </li>
                                <li> <a th:href="@{/feedBackManage}">信息反馈管理</a> </li>
                            </ul>
                        </li>
                    </ul>
                </nav>

                <!--<div class="sidebar-footer">
                  <p class="copyright">Copyright &copy; 2019. All rights reserved. More Templates 更多模板：<a href="http://www.mycodes.net/" target="_blank">模板之家</a></p>
                </div>-->
            </div>

        </aside>
        <!--End 左侧导航-->

        <!--头部信息-->
        <header class="lyear-layout-header" th:fragment="top">

            <nav class="navbar navbar-default">
                <div class="topbar">

                    <div class="topbar-left">
                        <div class="lyear-aside-toggler">
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                        </div>
                        <span class="navbar-page-title"> 独居老人列表 </span>
                    </div>

                    <ul th:replace="~{commons::topbar-right}"></ul>

                </div>
            </nav>

        </header>
        <!--End 头部信息-->

        <!--页面主要内容-->
        <main class="lyear-layout-content">

            <div class="container-fluid">

                <div class="row">
                    <div class="col-lg-12">
                        <div class="card">
                            <div class="card-toolbar clearfix">
                                <form class="pull-right form-inline"  th:action="@{/searchElderly}"  role="form">
                                    <div class="form-group">

                                        <input type="text" class="form-control col-xs-10" id="name" name="name"
                                               placeholder="请输入姓名">
                                        <span class="hidden-xs">&nbsp;</span>
                                        <span class="hidden-lg">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                                        <button class="btn btn-primary m-b-5" type="button" onclick="reset()"  ><i class="mdi mdi-refresh"></i> 重置</button>
                                        <button class="btn btn-success m-b-5" type="submit" ><i class="mdi mdi-magnify"></i> 搜索</button>
                                    </div>
                                </form>
                                <div th:if="${session.role!=0&&session.role!='2'}" class="toolbar-btn-action">
                                    <a class="btn btn-primary m-b-5" th:href="@{/toElderlyEdit}"><i class="mdi mdi-plus"></i> 新增</a>
                                    <!--<a class="btn btn-success m-b-5" th:href="@{/veteranEdit}"><i class="mdi mdi-pencil"></i> 修改</a>-->
                                    <!--<a class="btn btn-warning m-b-5" href="#!"><i class="mdi mdi-block-helper"></i> 禁用</a>-->
                                    <a class="btn btn-danger m-b-5" id="delete" th:onclick="elderlyDel2()"><i class="mdi mdi-window-close"></i> 删除</a>
                                </div>
                            </div>
                            <div class="card-body">

                                <div class="table-responsive">
                                    <table class="table table-bordered table-hover">
                                        <thead>
                                        <tr>
                                            <th>
                                                <label class="lyear-checkbox checkbox-primary">
                                                    <input type="checkbox" id="check-all"><span></span>
                                                </label>
                                            </th>
                                            <th>编号</th>
                                            <th>姓名</th>
                                            <th>电话</th>
                                            <th>年龄</th>
                                            <th>生日</th>
                                            <th>住址</th>
                                            <th width="120px">健康状况</th>
                                            <th width="120px">家庭状况</th>
                                            <th width="120px">监护人</th>
                                            <th width="120px">监护人电话</th>
                                            <th >操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr th:each="elderlies:${elderlies}">
                                            <td>
                                                <label class="lyear-checkbox checkbox-primary">
                                                    <input  type="checkbox" id="ids[]" name="ids[]" th:value="${elderlies.getId()}"><span></span>
                                                </label>
                                            </td>
                                            <td th:text="${elderliesStat.count}"></td>
                                            <td th:text="${elderlies.getName()}"></td>
                                            <td th:text="${elderlies.getPhone()}"></td>
                                            <td th:text="${elderlies.getAge()}"></td>
                                            <td th:text="${elderlies.getBirthday()}"></td>
                                            <td th:text="${elderlies.getAddress()}"></td>
                                            <td th:switch = "${elderlies.getHealth()}">
                                                <div th:case="1" th:text = "一般" ></div>
                                                <div th:case="0" th:text = "健康" ></div>
                                                <div th:case="2" th:text = "较差" style="color:red;" ></div>
                                            </td>
                                            <td th:switch = "${elderlies.getFamilyStatus()}">
                                                <div th:case="1" th:text = "困难" ></div>
                                                <div th:case="0" th:text = "一般" ></div>
                                                <div th:case="2" th:text = "特别困难" style="color:red;" ></div>
                                            </td>
                                            <td th:text="${elderlies.getGuardian()}"></td>
                                            <td th:text="${elderlies.getGuardianPhone()}"></td>
                                            <td>
                                                <div class="btn-group">
                                                    <a class="btn btn-xs btn-default" th:href="@{/elderlySMSSent/{id}/(id=${elderlies.getId()})}"  title="向其家人发送提示短信" data-toggle="tooltip"><i class="mdi mdi-eye"></i></a>
                                                    <a class="btn btn-xs btn-default" th:href="@{/elderlyLookInfo/{id}/(id=${elderlies.getId()})}"  title="查看" data-toggle="tooltip"><i class="mdi mdi-eye"></i></a>
                                                    <a  th:if="${session.role!=0&&session.role!='2'}" class="btn btn-xs btn-default" th:href="@{/toElderlyEdit/{id}/(id=${elderlies.getId()})}"  title="编辑" data-toggle="tooltip"><i class="mdi mdi-pencil"></i></a>
                                                    <a  th:if="${session.role!=0&&session.role!='2'}" class="btn btn-xs btn-default" th:onclick="|elderlyDel(${elderlies.getId()})|"  title="删除" data-toggle="tooltip"><i class="mdi mdi-window-close"></i></a>
                                                </div>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <div class="modal-footer" style="height: 70px;">
                                    <div  style="width: 300px;height:50px;float: left;" class="hidden-xs">
                                        <p style="margin-top: 29px;text-align: left">当前第<b> [[${elderliesPageInfo.pageNum}]]</b> 页,共<b> [[${elderliesPageInfo.pages}]] </b>页.一共<b> [[${elderliesPageInfo.total}]] </b>条记录</p>
                                    </div>

                                    <ul class="pagination hidden-xs" >
                                        <li th:if="${elderliesPageInfo.hasPreviousPage}">
                                            <a th:href="'/searchElderly?startPage=1'+'&name='+${session.name}">首页</a>
                                        </li>

                                        <li class="prev" th:if="${elderliesPageInfo.hasPreviousPage}">
                                            <a th:href="'/searchElderly?startPage='+${elderliesPageInfo.prePage}+'&name='+${session.name}">
                                                <i class="mdi mdi-chevron-left"></i>
                                            </a>
                                        </li>
                                        <!--遍历条数-->
                                        <li th:each="nav:${elderliesPageInfo.navigatepageNums}">
                                            <a th:href="'/searchElderly?startPage='+${nav}+'&name='+${session.name}" th:text="${nav}" th:if="${nav != elderliesPageInfo.pageNum}"></a>
                                            <span style="color:white;background: #35cabb;" th:if="${nav == elderliesPageInfo.pageNum}" th:text="${nav}" ></span>
                                        </li>

                                        <li class="next" th:if="${elderliesPageInfo.hasNextPage}">
                                            <a th:href="'/searchElderly?startPage='+${elderliesPageInfo.nextPage}+'&name='+${session.name}">
                                                <i class="mdi mdi-chevron-right"></i>
                                            </a>
                                        </li>

                                        <li th:if="${elderliesPageInfo.hasNextPage}">
                                            <a th:href="'/searchElderly?startPage='+${elderliesPageInfo.pages}+'&name='+${session.name}">尾页</a>
                                        </li>
                                    </ul>
                                    <ul class="pagination no-border visible-xs pagination-sm" style="text-align: center" >
                                        <li th:if="${elderliesPageInfo.hasPreviousPage}">
                                            <a th:href="'/searchElderly?startPage=1'+'&name='+${session.name}">首页</a>
                                        </li>

                                        <li class="prev" th:if="${elderliesPageInfo.hasPreviousPage}">
                                            <a th:href="'/searchElderly?startPage='+${elderliesPageInfo.prePage}+'&name='+${session.name}">
                                                <i class="mdi mdi-chevron-left"></i>
                                            </a>
                                        </li>
                                        <!--遍历条数-->
                                        <li th:each="nav:${elderliesPageInfo.navigatepageNums}">
                                            <a th:href="'/searchElderly?startPage='+${nav}+'&name='+${session.name}" th:text="${nav}" th:if="${nav != elderliesPageInfo.pageNum}"></a>
                                            <span style="color:white;background: #35cabb;" th:if="${nav == elderliesPageInfo.pageNum}" th:text="${nav}" ></span>
                                        </li>

                                        <li class="next" th:if="${elderliesPageInfo.hasNextPage}">
                                            <a th:href="'/searchElderly?startPage='+${elderliesPageInfo.nextPage}+'&name='+${session.name}">
                                                <i class="mdi mdi-chevron-right"></i>
                                            </a>
                                        </li>

                                        <li th:if="${elderliesPageInfo.hasNextPage}">
                                            <a th:href="'/searchElderly?startPage='+${elderliesPageInfo.pages}+'&name='+${session.name}">尾页</a>
                                        </li>
                                    </ul>

                                </div>

                            </div>
                        </div>
                    </div>

                </div>

            </div>
            <p th:text="${session.role}" id="p1" hidden></p>
        </main>
        <!--End 页面主要内容-->
    </div>
</div>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
<script type="text/javascript" src="/js/layer.js"></script>
<script type="text/javascript" src="js/elderly/elderlyList.js"></script>
<script type="text/javascript">
    var examineStatusSize = $("#examineStatusSize").text();
    if (examineStatusSize == 0){
        document.getElementById("examineStatusSize").style.display = "none";
    }
    var DelChildrenSize = $("#DelChildrenSize").text();
    if (DelChildrenSize == 0){
        document.getElementById("DelChildrenSize").style.display = "none";
    }
    var GiftSize = $("#GiftSize").text();
    if (GiftSize == 0){
        document.getElementById("GiftSize").style.display = "none";
    }
    var DelVeteranSize = $("#DelVeteranSize").text();
    if (DelVeteranSize == 0){
        document.getElementById("DelVeteranSize").style.display = "none";
    }
    var DelElderlySize = $("#DelElderlySize").text();
    if (DelElderlySize == 0) {
        document.getElementById("DelElderlySize").style.display = "none";
    }
        var cancellationSize = $("#cancellationSize").text();
        if (cancellationSize == 0) {
            document.getElementById("cancellationSize").style.display = "none";
        }
        var role = $("#p1").text();
        console.log(role)
        if (role == "0") {
            var admin = document.getElementById("admin");
            admin.style.display = "none";
            document.getElementById("elderlyGift").style.display = "none";
            document.getElementById("delElderly").style.display="none";
            document.getElementById("delVeteran").style.display="none";
            document.getElementById("delChildren").style.display="none";
        }
        if (role == "1") {
            document.getElementById("admin").style.display = "none";
            document.getElementById("community").style.display = "none";
            document.getElementById("examine").style.display = "none";
            document.getElementById("system").style.display = "none";
            document.getElementById("adminTotal").style.display = "none";
            document.getElementById("communityTotal").style.display = "none";
            document.getElementById("elderly").style.display = "none";
            document.getElementById("veteran").style.display = "none";
            document.getElementById("veteranNum").style.display = "none";
            document.getElementById("elderlyNum").style.display = "none";
            document.getElementById("giftExamine").style.display = "none";


        }
    if (role == 2 ){

        document.getElementById("delChildren").style.display="none";
        document.getElementById("delVeteran").style.display="none";
        document.getElementById("delElderly").style.display="none";
        document.getElementById("elderlyGift").style.display="none";

    }
        if (role == "3") {

            document.getElementById("admin").style.display = "none";
            document.getElementById("community").style.display = "none";
            document.getElementById("examineStatus").style.display = "none";
            document.getElementById("delElderly").style.display = "none";
            document.getElementById("delVeteran").style.display = "none";
            document.getElementById("giftExamine").style.display = "none";
            document.getElementById("system").style.display = "none";
            document.getElementById("adminTotal").style.display = "none";
            document.getElementById("communityTotal").style.display = "none";
            document.getElementById("elderly").style.display = "none";
            document.getElementById("veteran").style.display = "none";
            document.getElementById("veteranNum").style.display = "none";
            document.getElementById("elderlyNum").style.display = "none";
            document.getElementById("giftExamine").style.display = "none";
            document.getElementById("cancellation").style.display = "none";

        }
        if (role == "4") {

            document.getElementById("admin").style.display = "none";
            document.getElementById("children").style.display = "none";
            document.getElementById("elderly").style.display = "none";
            document.getElementById("community").style.display = "none";
            document.getElementById("examine").style.display = "none";
            document.getElementById("system").style.display = "none";
            document.getElementById("childrenNum").style.display = "none";
            document.getElementById("elderlyNum").style.display = "none";
            document.getElementById("giftExamine").style.display = "none";

        }
        if (role == "5") {

            document.getElementById("admin").style.display = "none";
            document.getElementById("children").style.display = "none";
            document.getElementById("elderly").style.display = "none";
            document.getElementById("community").style.display = "none";
            document.getElementById("examineStatus").style.display = "none";
            document.getElementById("delElderly").style.display = "none";
            document.getElementById("delChildren").style.display = "none";
            document.getElementById("cancellation").style.display = "none";
            document.getElementById("system").style.display = "none";
            document.getElementById("childrenNum").style.display = "none";
            document.getElementById("elderlyNum").style.display = "none";
            document.getElementById("giftExamine").style.display = "none";

        }
        if (role == "6") {

            document.getElementById("admin").style.display = "none";
            document.getElementById("children").style.display = "none";
            document.getElementById("veteran").style.display = "none";
            document.getElementById("community").style.display = "none";
            document.getElementById("examine").style.display = "none";
            document.getElementById("system").style.display = "none";
            document.getElementById("gift").style.display = "none";
            document.getElementById("giftExamine").style.display = "none";

        }
        if (role == "7") {

            document.getElementById("admin").style.display = "none";
            document.getElementById("children").style.display = "none";
            document.getElementById("veteran").style.display = "none";
            document.getElementById("community").style.display = "none";
            document.getElementById("examineStatus").style.display = "none";
            document.getElementById("delVeteran").style.display = "none";
            document.getElementById("delChildren").style.display = "none";
            document.getElementById("cancellation").style.display = "none";
            document.getElementById("system").style.display = "none";
            document.getElementById("giftExamine").style.display = "none";
            document.getElementById("gift").style.display = "none";
        }

</script>
</body>
</html>